//package org.yys.seata.config;
//
//import com.baomidou.mybatisplus.autoconfigure.MybatisPlusProperties;
//import org.apache.ibatis.session.SqlSessionFactory;
//import org.mybatis.spring.SqlSessionFactoryBean;
//import org.mybatis.spring.transaction.SpringManagedTransactionFactory;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.boot.context.properties.EnableConfigurationProperties;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
//
//import javax.sql.DataSource;
//
///**
// * 将DruidDataSource数据源配交给 seata
// */
//@Configuration
//@EnableConfigurationProperties({MybatisPlusProperties.class})
//public class DataSourceProxyConfig {
//    @Value("${mybatis-plus.mapper-locations}")
//    private String mapperLocations;
//
////    @Bean("dataSource")
////    @ConfigurationProperties(prefix = "spring.datasource.druid")
////    public DataSource druidDataSource(){
////        return new DruidDataSource();
////    }
//
////    @Bean
////    public DataSourceProxy dataSourceProxy(DataSource dataSource) {
////        return new DataSourceProxy(dataSource);
////    }
//
//    @Bean
//    public SqlSessionFactory sqlSessionFactoryBean(DataSource dataSource) throws Exception {
//        SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
//        sqlSessionFactoryBean.setDataSource(dataSource);
//        sqlSessionFactoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(mapperLocations));
//        sqlSessionFactoryBean.setTransactionFactory(new SpringManagedTransactionFactory());
//        return sqlSessionFactoryBean.getObject();
//    }
//}
